package com.snack.system.domain;

import com.snack.common.core.annotation.Excel;
import com.snack.common.core.web.domain.BaseEntity;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;

/**
 * 商品类型对象 ts_goods_type
 * 
 * @author snack
 * @date 2022-09-18
 */
@Data
public class TsGoodsType extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 商品类型id */
    private Long goodsTypeId;

    /** 父id */
    @Excel(name = "父id")
    private Long parentId;

    /** 祖级列表 */
    @Excel(name = "祖级列表")
    private String ancestors;

    /** 类型名 */
    @NotBlank(message = "类型名不能为空")
    @Size(min = 0, max = 20, message = "类型名长度不能超过20个字符")
    @Excel(name = "类型名")
    private String typeName;

    /** 显示顺序 */
    @Excel(name = "显示顺序")
    private Long orderNum;

    /** 状态（0正常 1停用） */
    @NotEmpty(message = "状态不能为空")
    @Pattern(regexp = "[01]",message = "状态格式错误")
    @Excel(name = "状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /** 删除标志（0代表存在 2代表删除） */
    private String delFlag;

    private List<TsGoodsType> children = new ArrayList<TsGoodsType>();

    @Valid
    private List<TsGoodsTypeParam> goodsTypeParamList;
}
